//
//  CheckConnections.m
//  changeView
//
//  Created by Marcelo Perretta on 29/06/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "CheckConnections.h"
#import "Reachability.h"
#import "AlertMessage.h"

@implementation CheckConnections

+(BOOL) checkInternetConections{
    Reachability* reachability = [[Reachability reachabilityWithHostName:@"www.apple.com"] retain];
    NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus];
    
    if(remoteHostStatus == NotReachable) { 
        [AlertMessage noInternetAccess];
        return NO;
        //3G - //Wifi
    }else if (remoteHostStatus == ReachableViaWWAN || remoteHostStatus == ReachableViaWiFi) { 
        return YES;
    }
    
    return NO;
}

/*-(void) runAlertMge:(NSString *)msg{
 UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:msg delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
 
 [Alert show];
 [Alert release];
 }*/


@end
